#include "sdk-impl_internal.h"
#include "utils_log.h"

/*  
    how to use. please follow down.

    Utils_OpenLog("ian"); 
    Utils_SetLogLevel(UTILS_LOG_DEBUG);
    log_debug("Hello word:%d\r\n",num);
        ...
    Utils_CloseLog();   
*/

void Utils_OpenLog(const char *ident)
{
    const char         *mod = ident;

    if (NULL == mod) {
        mod = "---";
    }

    LITE_openlog(mod);
}

void Utils_CloseLog(void)
{
    LITE_closelog();
}

void Utils_SetLogLevel(Utils_LogLevel level)
{
    LOGLEVEL            lvl = (LOGLEVEL)level;

    if (lvl > LOG_DEBUG_LEVEL) {
        log_err("Invalid input level: %d out of [%d, %d]", level,
                LOG_EMERG_LEVEL,
                LOG_DEBUG_LEVEL);
        return;
    }

    LITE_set_loglevel(lvl);
}